<template>
  <div class="editMyinfo">
    <van-nav-bar
      title="修改个人信息"
      right-text="保存"
      @click-right="baocun"
      left-arrow
      @click-left="$router.back()"
    />
    <van-cell-group inset>
      <van-field v-model="zhuanye" />
    </van-cell-group>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs } from 'vue'
import { useCounterStore } from '@/stores/counter'
import { editUserNameApi } from '@/http/api'
import { useRouter } from 'vue-router'
const router = useRouter()
const zhuanye = ref('')

const store = useCounterStore()
const baocun = async () => {
  const res = await editUserNameApi({
    id: store.res.id,
    major: zhuanye.value
  })
  console.log(res)
  if (res.code == 200) {
    router.push({ path: '/info', query: { name: zhuanye.value } })
  }
}
</script>
<style lang="scss" scoped>
.van-field {
  border: 1px solid #ccc;
}
</style>
